home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Games / WHDLoad / Src / slave-examples / hardwired.asm < prev    next >
Encoding:
Assembly Source File  |  2001-01-29  |  5.9 KB  |  297 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Program.    Hardwired.asm
  3. ;  :Contents.    Slave for "Hardwired" from Crionics and Silents
  4. ;  :Author.    Mr.Larmer of Wanted Team & Wepl
  5. ;  :Version.    $Id: hardwired.asm 1.3 2001/01/28 23:27:10 jah Exp jah $
  6. ;  :History.    09.11.97
  7. ;        22.12.97 (Wepl) adapted for Barfly
  8. ;             start message
  9. ;             wait part 1 added
  10. ;             blit fix (box to logo)
  11. ;             restart
  12. ;        10.12.00 rework, adapted for whdload v10+
  13. ;        28.01.01 Transformation of pixelized vectors fixed for 50 mhz 68030 (Harry)
  14. ;  :Requires.    -
  15. ;  :Copyright.    Public Domain
  16. ;  :Language.    68000 Assembler
  17. ;  :Translator.    Devpac 3.14, Barfly, AsmOne
  18. ;  :To Do.
  19. ;---------------------------------------------------------------------------*
  20.  
  21.     INCLUDE    whoami.i
  22.  
  23.     IFD HARRY
  24.     INCDIR    asm-one:Include2.0/
  25.     INCLUDE LIBRARIES/DOS_LIB.I
  26.     INCLUDE    LIBRARIES/DOS.I
  27.     INCLUDE EXEC/EXEC_LIB.I
  28.     INCLUDE    EXEC/MEMORY.I
  29.     INCLUDE    GRAPHICS/GRAPHICS_LIB.I
  30.     INCLUDE INTUITION/INTUITION_LIB.I
  31.     INCLUDE INTUITION/INTUITION.I
  32.     INCLUDE    OWN/CCRMAKRO
  33.     INCLUDE    own/whdload.i
  34.     INCLUDE    own/whdmacros.i
  35.     ENDC
  36.  
  37.     IFD WEPL
  38.     INCDIR    Includes:
  39.     INCLUDE    whdload.i
  40.     INCLUDE    whdmacros.i
  41.     OUTPUT    "DWArt:crionicssilents/hardwired/Hardwired.slave"
  42.     BOPT    O+            ;enable optimizing
  43.     BOPT    OG+            ;enable optimizing
  44.     BOPT    ODd-            ;disable mul optimizing
  45.     BOPT    ODe-            ;disable mul optimizing
  46.     BOPT    w4-            ;disable 64k warnings
  47.     BOPT    wo-            ;disable opt warnings
  48.     SUPER                ;disable supervisor warnings
  49.     ENDC
  50.  
  51. ;DEBUG
  52.  IFD DEBUG
  53. PATCHCOUNT
  54.  ENDC
  55.  
  56. ;============================================================================
  57.  
  58. _base        SLAVE_HEADER            ;ws_Security + ws_ID
  59.         dc.w    10            ;ws_Version
  60.         dc.w    WHDLF_Disk|WHDLF_NoError|WHDLF_EmulTrap    ;ws_flags
  61.         dc.l    $100000            ;ws_BaseMemSize
  62.         dc.l    0            ;ws_ExecInstall
  63.         dc.w    Start-_base        ;ws_GameLoader
  64.         dc.w    0            ;ws_CurrentDir
  65.         dc.w    0            ;ws_DontCache
  66. _keydebug    dc.b    0            ;ws_keydebug
  67. _keyexit    dc.b    $59            ;ws_keyexit = F10
  68. EXPMEM = $1000
  69. _expmem        dc.l    EXPMEM                  ;ws_ExpMem
  70.         dc.w    _name-_base             ;ws_name
  71.         dc.w    _copy-_base             ;ws_copy
  72.         dc.w    _info-_base             ;ws_info
  73.  
  74. ;============================================================================
  75.  
  76.     IFD BARFLY
  77.     DOSCMD  "WDate  >T:date"
  78.     ENDC
  79.  
  80. _name        dc.b    "Hardwired",0
  81. _copy        dc.b    "1991 Crionics/Silents",0
  82. _info        dc.b    "installed and fixed by Mr.Larmer & Wepl & Harry",10
  83.         dc.b    "Version 1.1 "
  84.     IFD BARFLY
  85.         INCBIN    "T:date"
  86.     ENDC
  87.         dc.b    0
  88.     EVEN
  89.  
  90. ;======================================================================
  91. Start    ;    A0 = resident loader
  92. ;======================================================================
  93.  
  94.         lea    _resload(pc),a1
  95.         move.l    a0,(a1)            ;save for later use
  96.  
  97.         move.l    (_expmem),a7
  98.         add.l    #EXPMEM-8,a7
  99.  
  100. _start        bsr    _CacheOn
  101.         
  102.         move    #0,sr            ;user mode
  103.  
  104.         move.l    #0,d0            ;offset
  105.         move.l    #$2c00,d1        ;size
  106.         moveq    #1,d2            ;disk
  107.         lea    $7c00,a0        ;data
  108.         move.l    (_resload),a3
  109.         jsr    (resload_DiskLoad,a3)
  110.  
  111.         skip    $80be-$8030,$8030    ;skip checking cpu speed and ext memory
  112.  
  113.         clr.w    $80ca            ;fix destroyed start message
  114.         lea    $87f8,a0
  115.         lea    ($340,a0),a1
  116.         lea    ($d0,a0),a2
  117. .cp        move.l    (a1)+,(a0)+
  118.         cmp.l    a2,a0
  119.         blo    .cp
  120.  
  121.         pea    _1
  122.         move.l    (a7)+,$80fc
  123.  
  124.         jmp    $8000
  125.  
  126. _1        skip    $244-$21e,$21e        ; clear mem
  127.  
  128.         move.w    #$6008,$386.w        ; skip set address in jmp 0
  129.  
  130.         pea    Patch3(pc)
  131.         move.l    (A7)+,$3D0.w
  132.  
  133.         move.w    #$4EF9,$3F4.w
  134.         pea    Load(pc)
  135.         move.l    (A7)+,$3F6.w
  136.  
  137.         jmp    $200
  138.  
  139. Patch3        move.w    #$4EF9,$E3350
  140.         pea    Load(pc)
  141.         move.l    (A7)+,$E3352
  142.  
  143.         patch    $e40b2,_ChangeDisk
  144.         
  145.         patchs    $e420e,_coff
  146.  
  147.         move.l    #$4E714EB9,$E44D0
  148.         pea    Patch5(pc)
  149.         move.l    (A7)+,$E44D4
  150.         
  151.     IFD DEBUG
  152.         ret    $e4e62
  153.         nops    1,$e427a        ;skip "credits"
  154.         ret    $e468a            ;skip "zoom scroll"
  155.         ret    $e4730            ;skip "cube"
  156.         ret    $e47a6            ;skip "shade bobs"
  157.     ;    ret    $e4850            ;skip "glenz"
  158.     ;    ret    $e9d0a            ;skip "spline"
  159.     ENDC
  160.     
  161.     ;    st    $e7df6
  162.     ;    patchs    $e48d0,_gl1
  163.     ;    patch    $e48c6,_gl1
  164.     ;    ill    $e7d70
  165.         
  166.         move.w    #$082c,$f868e        ;btst #14,(2,a6) --> btst #14,(2,a4)
  167.         lea    $f7000,a0
  168.         lea    $f9000,a1
  169.         lea    $10,a2
  170.         bsr    _blitfix_imm_58a6
  171.         
  172.     ;    patchs    $e4de0,_af1
  173.  
  174.     ;    patch    $fa5b0,.bw1
  175.  
  176.         move.l    #$c9444eb9,$f91c6    ;patch vbi of pixelized vectors
  177.         pea    waitl2c(pc)
  178.         move.l    (a7)+,$f91ca
  179.         
  180.         jmp    $e3fbc
  181.  
  182. waitl2c        move.l    d0,-(a7)        ;wait to fix transformation of pixelized v.
  183. .1        move.l    $dff004,d0
  184.         and.l    #$3ff00,d0
  185.         cmp.l    #$2c00,d0
  186.         bls.s    .1
  187.         move.l    (a7)+,d0
  188.         cmp.w    #$c8,$f93ae
  189.         rts
  190.  
  191.     ifeq 1
  192. _af1        cmp.w    #40,$dff006
  193.         bls    _af1
  194.         tst.l    $e4e5a
  195.         rts
  196.     endc
  197.  
  198.     ifeq 1
  199. _gl1        waitvb
  200.         move.l    #$e4920,$e4e5a
  201.         jmp    $e48d0
  202.     endc
  203.  
  204. _ChangeDisk    lea    DiskNr(pc),A0
  205.         move.w    #2,(A0)
  206.  
  207.     IFND DEBUG
  208.         bsr    _CacheOff
  209.         
  210.         jsr    $fa11a            ;the first part
  211.  
  212. .wait        cmp.w    #$390,$fc82e
  213.         blo    .wait
  214.  
  215.         bsr    _CacheOn
  216.     ENDC
  217.  
  218.         jmp    $e40de
  219.  
  220. _coff        bsr    _CacheOff
  221.         jmp    $e2ae8            ;original
  222.  
  223. Patch5        pea    Patch6(pc)
  224.         move.l    (A7)+,$AC68E
  225.  
  226.         clr.l    $DFF1BC
  227.         jmp    (A0)
  228.  
  229. Patch6        move.w    #$4EF9,$35EB0
  230.         pea    Load(pc)
  231.         move.l    (A7)+,$35EB2
  232.  
  233.         move.l    #$4E714EB9,$36154
  234.         pea    Patch7(pc)
  235.         move.l    (A7)+,$36158
  236.  
  237.         jmp    $360C0
  238. Patch7
  239.         pea    _restart
  240.         move.l    (A7)+,$80.w
  241.  
  242.         move.w    #$4E40,$3D308        ; use trap #0 for exit
  243.  
  244.         move.l    $36234,A0
  245.         jmp    (A0)
  246.  
  247. _restart    waitvb
  248.         move.w    #$7fff,_custom+dmacon
  249.         move.w    #$7fff,_custom+intena
  250.         lea    $80000,a7
  251.         lea    (DiskNr),a0
  252.         move.w    #1,(a0)
  253.         bra    _start
  254.  
  255. DiskNr        dc.w    1
  256.  
  257. Load        movem.l    D0-A2,-(A7)
  258.         mulu    #$1600,D0
  259.         mulu    #$1600,D1
  260.         move.w    DiskNr(pc),d2
  261.         move.l    _resload(pc),a2
  262.         jsr    resload_DiskLoad(a2)
  263.         movem.l    (A7)+,D0-A2
  264.         rts
  265.  
  266. ;--------------------------------
  267.  
  268. _CacheOn    movem.l    d0-d1/a0-a1,-(a7)
  269.         moveq    #CACRF_EnableI,d0
  270.         moveq    #CACRF_EnableI,d1
  271.         move.l    (_resload),a0
  272.         jsr    (resload_SetCACR,a0)
  273.         movem.l    (a7)+,d0-d1/a0-a1
  274.         rts
  275.  
  276. _CacheOff    movem.l    d0-d1/a0-a1,-(a7)
  277.         moveq    #0,d0
  278.         moveq    #CACRF_EnableI,d1
  279.         move.l    (_resload),a0
  280.         jsr    (resload_SetCACR,a0)
  281.         movem.l    (a7)+,d0-d1/a0-a1
  282.         rts
  283.  
  284. ;--------------------------------
  285.  
  286. _resload    dc.l    0        ;address of resident loader
  287.  
  288. ;======================================================================
  289.  
  290.     INCLUDE    Sources:whdload/blitfix_imm_58a6.s
  291.  
  292. ;======================================================================
  293.  
  294.     END
  295.  
  296.  
  297.